package huy.mmt.gamelathinh.dialog;

import huy.mmt.gamelathinh.Logo;
import huy.mmt.gamelathinh.Play;
import huy.mmt.gamelathinh.R;
import huy.mmt.gamelathinh.components.Level;
import huy.mmt.gamelathinh.components.Score;
import huy.mmt.gamelathinh.util.Util;
import huy.mmt.gamelathinh.util.UtilDialog;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

/**
 * Khi hết thời gian sẽ hiện các daialog này Hiển thị các thông tin điểm thua,
 * level đang ở trạng thái thua
 * 
 */
public class DialogGameOver extends Dialog implements
		android.view.View.OnClickListener {
	Activity activity;
	TextView mScoreGameOver;

	public DialogGameOver(Context context) {
		super(context);
		UtilDialog.iniDialog(this);
		activity = (Activity) context;
		Logo.ms_gameover.start();
		setContentView(R.layout.dialog_gameover);
		// resize dialog
		LinearLayout linearLayout = (LinearLayout) findViewById(R.id.linearlayout_all);
		Util.resizeDialog(linearLayout);
		// button
		Button button_yes = (Button) findViewById(R.id.button_yes);
		button_yes.setOnClickListener(this);
		// thong bao diem thua va level thua
		mScoreGameOver = (TextView) findViewById(R.id.textView_score);
		mScoreGameOver.setText(String.valueOf(Score.score_current) + "-"
				+ "Level :" + String.valueOf(Level.level_current));

	}

	@Override
	public void onClick(View v) {
		Logo.ms_click.start();
		switch (v.getId()) {
		case R.id.button_yes:
			this.dismiss();
			Activity play = (Play) activity;
			play.finish();

			break;
		default:
			break;
		}

	}

}